import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Medalla here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Medalla extends Bono
{
    private GreenfootImage [] medalla;
    private int delay =0;
    private int sprite=0;
    /**
     * Act - do whatever the Medalla wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    
    public Medalla()
    {   
        super(100);
        medalla=new GreenfootImage[7];
         for(int i=1; i<=medalla.length; i++)
        {
            medalla[i-1] = new GreenfootImage("Medal"+i+".png");
            medalla[i-1].scale(35,35);
        }
       
        setImage(medalla[sprite]);
    }
    public void act() 
    {
        this.animacion();
        super.act();
        
        // Add your action code here.
    } 
    public void animacion()
    {
       
        if(delay==4)
        {
            delay=0;
            sprite++;
            if(sprite==medalla.length-1)
            sprite=0;
            
            setImage(medalla[sprite]);
        }
        else
        delay++;
    }
}
